#include <iostream>
#include <unistd.h>
#include <stdlib.h>

using namespace std;

int main()
{
    int pipefd[2];
    pipe(pipefd);

    pid_t id=fork();
    if(id==0)
    {
        char readbuffer[1024];
        read(pipefd[0],readbuffer,1024);
        cout<<readbuffer<<endl;
        exit(0);
    }

    char writebuffer[1024]="i am father";
    write(pipefd[1],writebuffer,1024);

    // waitpid(id,nullptr,0);

    return 0;
}